﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using YArchitech.Controls;
using YArchitech.DataModel;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace YArchitech.HVAC.Nozzle
{
	public partial class FormLayNozzle : System.Windows.Forms.Form
	{
		public GlobeNozzle GlobeNozzleData { get; set; }

		public CylindricalNozzle CylindricalNozzleData { get; set; }

		public int NozzleType { get; set; }

		public int Layway { get; set; }

		public FormLayNozzle()
		{
			this.InitializeComponent();
			new YJKProcessTools().ShowInTaskbarChange(this);
			base.Icon = Resource.YArchitechIcon;
			this._isFirstInit = true;
			this.nsd = new NozzleSqlData();
			this.InitFormData();
			if (this.gfd.IsAuto)
			{
				this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
			}
			else
			{
				FrmBallTable frmBallTable = new FrmBallTable(this.nsd.dtGlobeNozzleFormat);
				frmBallTable.GetGlobeNozzlesByDefault(this.grow, this.gcol);
				this.bindGlobeNozzle(frmBallTable.GlobeNozzles);
			}
			if (this.cfd.IsAuto)
			{
				this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
			}
			else
			{
				FrmCylindricTable frmCylindricTable = new FrmCylindricTable(this.nsd.dtCylindricalNozzle, this.nsd.dtCylindricalNozzleFormat);
				frmCylindricTable.GetSprinklerRes(this.tabindex, this.cyrow, this.cycol);
				this.bindCylindricalNozzles(frmCylindricTable.CylindricalNozzles, this.tabindex);
			}
			this._isFirstInit = false;
		}

		private void InitFormData()
		{
			Dictionary<string, string> globeNozzleFormData = this.userSetting.GetGlobeNozzleFormData();
			this.NozzleType = Convert.ToInt32(this.userSetting.GetValueFromDic("nozzleType", "10", globeNozzleFormData));
			this.gfd.IsSheCheng = Convert.ToBoolean(this.userSetting.GetValueFromDic("gIsSheCheng", "true", globeNozzleFormData));
			this.gfd.IsFengSu = Convert.ToBoolean(this.userSetting.GetValueFromDic("gIsFengSu", "true", globeNozzleFormData));
			this.gfd.IsFengLiang = Convert.ToBoolean(this.userSetting.GetValueFromDic("gIsFengLiang", "true", globeNozzleFormData));
			this.gfd.SheCheng = Convert.ToInt32(this.userSetting.GetValueFromDic("gSheCheng", "10", globeNozzleFormData));
			this.gfd.FengSu = Convert.ToDouble(this.userSetting.GetValueFromDic("gFengSu", "0.5", globeNozzleFormData));
			this.gfd.FengliangL = Convert.ToInt32(this.userSetting.GetValueFromDic("gFengliangL", "90", globeNozzleFormData));
			this.gfd.FengliangM = Convert.ToInt32(this.userSetting.GetValueFromDic("gFengliangM", "1100", globeNozzleFormData));
			this.gfd.IsAuto = Convert.ToBoolean(this.userSetting.GetValueFromDic("gIsAuto", "true", globeNozzleFormData));
			this.grow = this.userSetting.GetValueFromDic("gRow", "0", globeNozzleFormData);
			this.gcol = this.userSetting.GetValueFromDic("gCol", "0", globeNozzleFormData);
			this.cfd.IsSheCheng = Convert.ToBoolean(this.userSetting.GetValueFromDic("cIsSheCheng", "true", globeNozzleFormData));
			this.cfd.IsQiLiu = Convert.ToBoolean(this.userSetting.GetValueFromDic("cIsQiLiu", "true", globeNozzleFormData));
			this.cfd.IsFengLiang = Convert.ToBoolean(this.userSetting.GetValueFromDic("cIsFengLiang", "true", globeNozzleFormData));
			this.cfd.Count = Convert.ToInt32(this.userSetting.GetValueFromDic("cCount", "1", globeNozzleFormData));
			this.cfd.FengliangL = Convert.ToInt32(this.userSetting.GetValueFromDic("cFengliangL", "340", globeNozzleFormData));
			this.cfd.FengliangM = Convert.ToInt32(this.userSetting.GetValueFromDic("cFengliangM", "4500", globeNozzleFormData));
			this.cfd.SheChengL = Convert.ToInt32(this.userSetting.GetValueFromDic("cSheChengL", "8", globeNozzleFormData));
			this.cfd.SheChengM = Convert.ToInt32(this.userSetting.GetValueFromDic("cSheChengM", "20", globeNozzleFormData));
			this.cfd.QiLiuL = Convert.ToDouble(this.userSetting.GetValueFromDic("cQiLiuL", "4", globeNozzleFormData));
			this.cfd.QiLiuM = Convert.ToDouble(this.userSetting.GetValueFromDic("cQiLiuM", "11", globeNozzleFormData));
			this.cfd.IsAuto = Convert.ToBoolean(this.userSetting.GetValueFromDic("cIsAuto", "true", globeNozzleFormData));
			this.cycol = this.userSetting.GetValueFromDic("cCol", "0", globeNozzleFormData);
			this.cyrow = this.userSetting.GetValueFromDic("cRow", "0", globeNozzleFormData);
			this.tabindex = this.userSetting.GetValueFromDic("cTabIndex", "0", globeNozzleFormData);
			this.InitNozzleFromData();
		}

		private void InitNozzleFromData()
		{
			this.tabNozzle.SelectedIndex = this.NozzleType;
			this.rdoAuto.Checked = true;
			this.cbSheCheng.Checked = this.gfd.IsSheCheng;
			this.cbSheLiu.Checked = this.gfd.IsFengSu;
			this.cbFengLiang.Checked = this.gfd.IsFengLiang;
			if (this.gfd.SheCheng == 0)
			{
				this.combSheCheng.SelectedIndex = 0;
			}
			else
			{
				this.combSheCheng.SelectedItem = this.gfd.SheCheng.ToString();
			}
			if (Math.Abs(this.gfd.FengSu) < 1E-06)
			{
				this.combSheLiu.SelectedIndex = 0;
			}
			else
			{
				this.combSheLiu.SelectedItem = this.gfd.FengSu.ToString(CultureInfo.InvariantCulture);
			}
			this.tbFengLiangL.Text = this.gfd.FengliangL.ToString();
			this.tbFengLiangM.Text = this.gfd.FengliangM.ToString();
			string text = Path.Combine(Product.FamilyImageLocation, "Nozzle", "球形喷口.png");
			if (File.Exists(text))
			{
				this.pbGlobe.Image = Image.FromFile(text);
			}
			if (this.gfd.IsAuto)
			{
				this.rdoAuto.Checked = true;
			}
			else
			{
				this.rdoTable.Checked = true;
			}
			this.rdoCyAuto.Checked = true;
			this.combCyCount.SelectedIndex = this.cfd.Count;
			this.cbCySheCheng.Checked = this.cfd.IsSheCheng;
			this.cbCyFengLiang.Checked = this.cfd.IsFengLiang;
			this.cbCyQiLiu.Checked = this.cfd.IsQiLiu;
			this.hyCySheChengL.Text = this.cfd.SheChengL.ToString();
			this.hyCySheChengM.Text = this.cfd.SheChengM.ToString();
			this.hyCyQiLiuL.Text = this.cfd.QiLiuL.ToString(CultureInfo.InvariantCulture);
			this.hyCyQiLiuM.Text = this.cfd.QiLiuM.ToString(CultureInfo.InvariantCulture);
			this.hyCyFengLiangL.Text = this.cfd.FengliangL.ToString();
			this.hyCyFengLiangM.Text = this.cfd.FengliangM.ToString();
			string path = "筒形喷口_" + this.cfd.Count + ".png";
			string text2 = Path.Combine(Product.FamilyImageLocation, "Nozzle", path);
			if (File.Exists(text2))
			{
				this.pbCy.Image = Image.FromFile(text2);
			}
			if (this.cfd.IsAuto)
			{
				this.rdoCyAuto.Checked = true;
				return;
			}
			this.rdoCyTable.Checked = true;
		}

		private void WriteFormData()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary.Add("nozzleType", this.tabNozzle.SelectedIndex.ToString());
			dictionary.Add("gIsSheCheng", this.gfd.IsSheCheng.ToString());
			dictionary.Add("gIsFengSu", this.gfd.IsFengSu.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("gIsFengLiang", this.gfd.IsFengLiang.ToString());
			dictionary.Add("gSheCheng", this.gfd.SheCheng.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("gFengSu", this.gfd.FengSu.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("gFengliangL", this.gfd.FengliangL.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("gFengliangM", this.gfd.FengliangM.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("gIsAuto", this.rdoAuto.Checked.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("gCol", this.gcol);
			dictionary.Add("gRow", this.grow);
			dictionary.Add("cIsSheCheng", this.cfd.IsSheCheng.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cIsQiLiu", this.cfd.IsQiLiu.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cIsFengLiang", this.cfd.IsFengLiang.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cCount", this.cfd.Count.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cFengliangL", this.cfd.FengliangL.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cFengliangM", this.cfd.FengliangM.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cSheChengL", this.cfd.SheChengL.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cSheChengM", this.cfd.SheChengM.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cQiLiuL", this.cfd.QiLiuL.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cQiLiuM", this.cfd.QiLiuM.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cIsAuto", this.rdoCyAuto.Checked.ToString(CultureInfo.InvariantCulture));
			dictionary.Add("cCol", this.cycol);
			dictionary.Add("cRow", this.cyrow);
			dictionary.Add("cTabIndex", this.tabindex);
			this.userSetting.WriteNozzleFormData(dictionary);
		}

		private void btnTable_Click(object sender, EventArgs e)
		{
			FrmBallTable frmBallTable = new FrmBallTable(this.nsd.dtGlobeNozzleFormat);
			frmBallTable.ShowDialog();
			if (frmBallTable.gcol != "0" && frmBallTable.grow != "0")
			{
				this.gcol = frmBallTable.gcol;
				this.grow = frmBallTable.grow;
			}
			this.bindGlobeNozzle(frmBallTable.GlobeNozzles);
		}

		private void bindGlobeNozzle(List<GlobeNozzle> GlobeNozzles)
		{
			if (GlobeNozzles != null && GlobeNozzles.Count > 0)
			{
				this.dgvGlobe.Rows.Clear();
				foreach (GlobeNozzle globeNozzle in GlobeNozzles)
				{
					this.dgvGlobe.Rows.Add(new object[]
					{
						globeNozzle,
						globeNozzle.FengSu,
						globeNozzle.SheCheng,
						globeNozzle.FengLiang,
						globeNozzle.GuiGe,
						globeNozzle.FengKouDn,
						globeNozzle.HouKouDn,
						globeNozzle.D1,
						globeNozzle.D2,
						globeNozzle.D3,
						globeNozzle.D4,
						globeNozzle.E,
						globeNozzle.F,
						globeNozzle.L1,
						globeNozzle.L2
					});
				}
			}
		}

		private void rdoAuto_CheckedChanged(object sender, EventArgs e)
		{
			if (this.rdoAuto.Checked)
			{
				this.btnTable.Enabled = false;
				this.hyGroupBoxBlackSide3.Enabled = true;
				this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
				return;
			}
			this.btnTable.Enabled = true;
			this.hyGroupBoxBlackSide3.Enabled = false;
			this.dgvGlobe.Rows.Clear();
			FrmBallTable frmBallTable = new FrmBallTable(this.nsd.dtGlobeNozzleFormat);
			frmBallTable.GetGlobeNozzlesByDefault(this.grow, this.gcol);
			this.bindGlobeNozzle(frmBallTable.GlobeNozzles);
		}

		private void cbSheCheng_CheckedChanged(object sender, EventArgs e)
		{
			if (this.combSheCheng.SelectedIndex == 0)
			{
				this.gfd.IsSheCheng = false;
				this.gfd.SheCheng = 0;
			}
			else
			{
				this.gfd.IsSheCheng = this.cbSheCheng.Checked;
			}
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void cbSheLiu_CheckedChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.combSheLiu.SelectedIndex == 0)
			{
				this.gfd.IsFengSu = false;
				this.gfd.FengSu = 0.0;
			}
			else
			{
				this.gfd.IsFengSu = this.cbSheLiu.Checked;
			}
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void cbFengLiang_CheckedChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			this.gfd.IsFengLiang = this.cbFengLiang.Checked;
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void combSheCheng_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.combSheCheng.SelectedIndex == 0)
			{
				this.gfd.IsSheCheng = false;
				this.gfd.SheCheng = 0;
			}
			else
			{
				this.gfd.SheCheng = Convert.ToInt32(this.combSheCheng.SelectedItem.ToString());
				this.gfd.IsSheCheng = this.cbSheCheng.Checked;
			}
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void combSheLiu_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.combSheLiu.SelectedIndex == 0)
			{
				this.gfd.IsFengSu = false;
				this.gfd.FengSu = 0.0;
			}
			else
			{
				this.gfd.FengSu = Convert.ToDouble(this.combSheLiu.SelectedItem.ToString());
				this.gfd.IsFengSu = this.cbSheLiu.Checked;
			}
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void tbFengLiangL_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.tbFengLiangL.Text.Trim().Contains(".") || this.tbFengLiangM.Text.Trim().Contains("."))
			{
				YJKMessageBox.Show("输入的风量必须是整数");
				return;
			}
			int num = Convert.ToInt32(this.tbFengLiangL.Text.Trim());
			int num2 = Convert.ToInt32(this.tbFengLiangM.Text.Trim());
			if (num <= num2)
			{
				this.gfd.FengliangL = num;
				this.gfd.FengliangM = num2;
			}
			else
			{
				this.gfd.FengliangL = num2;
				this.gfd.FengliangM = num;
			}
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void tbFengLiangM_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.tbFengLiangL.Text.Trim().Contains(".") || this.tbFengLiangM.Text.Trim().Contains("."))
			{
				YJKMessageBox.Show("输入的风量必须是整数");
				return;
			}
			int num = Convert.ToInt32(this.tbFengLiangL.Text.Trim());
			int num2 = Convert.ToInt32(this.tbFengLiangM.Text.Trim());
			if (num <= num2)
			{
				this.gfd.FengliangL = num;
				this.gfd.FengliangM = num2;
			}
			else
			{
				this.gfd.FengliangL = num2;
				this.gfd.FengliangM = num;
			}
			this.nsd.BindDataGridDataGlobe(this.dgvGlobe, this.gfd);
		}

		private void bntCyTable_Click(object sender, EventArgs e)
		{
			FrmCylindricTable frmCylindricTable = new FrmCylindricTable(this.nsd.dtCylindricalNozzle, this.nsd.dtCylindricalNozzleFormat);
			frmCylindricTable.ShowDialog();
			if (frmCylindricTable.TabIndex != "0" && frmCylindricTable.cycol != "0" && frmCylindricTable.cyrow != "0")
			{
				this.tabindex = frmCylindricTable.TabIndex;
				this.cycol = frmCylindricTable.cycol;
				this.cyrow = frmCylindricTable.cyrow;
			}
			this.bindCylindricalNozzles(frmCylindricTable.CylindricalNozzles, frmCylindricTable.Count);
		}

		private void bindCylindricalNozzles(List<CylindricalNozzle> CylindricalNozzles, string Count)
		{
			if (CylindricalNozzles != null && CylindricalNozzles.Count > 0)
			{
				this.dgvCy.Rows.Clear();
				foreach (CylindricalNozzle cylindricalNozzle in CylindricalNozzles)
				{
					this.dgvCy.Rows.Add(new object[]
					{
						cylindricalNozzle,
						cylindricalNozzle.QiLiu,
						cylindricalNozzle.SheCheng,
						cylindricalNozzle.FengLiang,
						cylindricalNozzle.GuiGe,
						cylindricalNozzle.FengKouDn,
						cylindricalNozzle.HouKouDn,
						cylindricalNozzle.B,
						cylindricalNozzle.C,
						cylindricalNozzle.D,
						cylindricalNozzle.E,
						cylindricalNozzle.F,
						cylindricalNozzle.H,
						cylindricalNozzle.L,
						cylindricalNozzle.L2,
						cylindricalNozzle.L3
					});
				}
				string path = "筒形喷口_" + Count + ".png";
				string text = Path.Combine(Product.FamilyImageLocation, "Nozzle", path);
				if (File.Exists(text))
				{
					this.pbCy.Image = Image.FromFile(text);
				}
			}
		}

		private void rdoCyAuto_CheckedChanged(object sender, EventArgs e)
		{
			string path;
			if (this.rdoCyAuto.Checked)
			{
				this.bntCyTable.Enabled = false;
				this.hyGroupBoxBlackSide5.Enabled = true;
				path = "筒形喷口_" + this.cfd.Count + ".png";
				this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
			}
			else
			{
				this.bntCyTable.Enabled = true;
				this.hyGroupBoxBlackSide5.Enabled = false;
				this.dgvCy.Rows.Clear();
				FrmCylindricTable frmCylindricTable = new FrmCylindricTable(this.nsd.dtCylindricalNozzle, this.nsd.dtCylindricalNozzleFormat);
				frmCylindricTable.GetSprinklerRes(this.tabindex, this.cyrow, this.cycol);
				path = "筒形喷口_" + this.tabindex + ".png";
				this.bindCylindricalNozzles(frmCylindricTable.CylindricalNozzles, this.tabindex);
			}
			string text = Path.Combine(Product.FamilyImageLocation, "Nozzle", path);
			if (File.Exists(text))
			{
				this.pbCy.Image = Image.FromFile(text);
			}
		}

		private void combCyCount_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.combCyCount.SelectedIndex == 0)
			{
				this.cfd.Count = 0;
			}
			else
			{
				this.cfd.Count = Convert.ToInt32(this.combCyCount.SelectedItem.ToString());
				string path = "筒形喷口_" + this.cfd.Count + ".png";
				string text = Path.Combine(Product.FamilyImageLocation, "Nozzle", path);
				if (File.Exists(text))
				{
					this.pbCy.Image = Image.FromFile(text);
				}
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void cbCySheCheng_CheckedChanged(object sender, EventArgs e)
		{
			this.cfd.IsSheCheng = this.cbCySheCheng.Checked;
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void cbCyQiLiu_CheckedChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			this.cfd.IsQiLiu = this.cbCyQiLiu.Checked;
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void cbCyFengLiang_CheckedChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			this.cfd.IsFengLiang = this.cbCyFengLiang.Checked;
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void hyCySheChengL_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.hyCySheChengL.Text.Trim().Contains(".") || this.hyCySheChengM.Text.Trim().Contains("."))
			{
				YJKMessageBox.Show("输入的射程必须是整数");
				return;
			}
			int num = Convert.ToInt32(this.hyCySheChengL.Text.Trim());
			int num2 = Convert.ToInt32(this.hyCySheChengM.Text.Trim());
			if (num <= num2)
			{
				this.cfd.SheChengL = num;
				this.cfd.SheChengM = num2;
			}
			else
			{
				this.cfd.SheChengL = num2;
				this.cfd.SheChengM = num;
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void hyCySheChengM_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.hyCySheChengL.Text.Trim().Contains(".") || this.hyCySheChengM.Text.Trim().Contains("."))
			{
				YJKMessageBox.Show("输入的射程必须是整数");
				return;
			}
			int num = Convert.ToInt32(this.hyCySheChengL.Text.Trim());
			int num2 = Convert.ToInt32(this.hyCySheChengM.Text.Trim());
			if (num <= num2)
			{
				this.cfd.SheChengL = num;
				this.cfd.SheChengM = num2;
			}
			else
			{
				this.cfd.SheChengL = num2;
				this.cfd.SheChengM = num;
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void hyCyQiLiuL_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			double num = Convert.ToDouble(this.hyCyQiLiuL.Text.Trim());
			double num2 = Convert.ToDouble(this.hyCyQiLiuM.Text.Trim());
			if (num <= num2)
			{
				this.cfd.QiLiuL = num;
				this.cfd.QiLiuM = num2;
			}
			else
			{
				this.cfd.QiLiuL = num2;
				this.cfd.QiLiuM = num;
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void hyCyQiLiuM_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			double num = Convert.ToDouble(this.hyCyQiLiuL.Text.Trim());
			double num2 = Convert.ToDouble(this.hyCyQiLiuM.Text.Trim());
			if (num <= num2)
			{
				this.cfd.QiLiuL = num;
				this.cfd.QiLiuM = num2;
			}
			else
			{
				this.cfd.QiLiuL = num2;
				this.cfd.QiLiuM = num;
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void hyCyFengLiangL_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.hyCyFengLiangL.Text.Trim().Contains(".") || this.hyCyFengLiangM.Text.Trim().Contains("."))
			{
				YJKMessageBox.Show("输入的风量必须是整数");
				return;
			}
			int num = Convert.ToInt32(this.hyCyFengLiangL.Text.Trim());
			int num2 = Convert.ToInt32(this.hyCyFengLiangM.Text.Trim());
			if (num <= num2)
			{
				this.cfd.FengliangL = num;
				this.cfd.FengliangM = num2;
			}
			else
			{
				this.cfd.FengliangL = num2;
				this.cfd.FengliangM = num;
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void hyCyFengLiangM_TextChanged(object sender, EventArgs e)
		{
			if (this._isFirstInit)
			{
				return;
			}
			if (this.hyCyFengLiangL.Text.Trim().Contains(".") || this.hyCyFengLiangM.Text.Trim().Contains("."))
			{
				YJKMessageBox.Show("输入的风量必须是整数");
				return;
			}
			int num = Convert.ToInt32(this.hyCyFengLiangL.Text.Trim());
			int num2 = Convert.ToInt32(this.hyCyFengLiangM.Text.Trim());
			if (num <= num2)
			{
				this.cfd.FengliangL = num;
				this.cfd.FengliangM = num2;
			}
			else
			{
				this.cfd.FengliangL = num2;
				this.cfd.FengliangM = num;
			}
			this.nsd.BindDataGridDataCy(this.dgvCy, this.cfd);
		}

		private void btnLayOne_Click(object sender, EventArgs e)
		{
			this.NozzleType = this.tabNozzle.SelectedIndex;
			this.Layway = 0;
			this.GetLayNozzleData();
		}

		private void btnLayPipe_Click(object sender, EventArgs e)
		{
			this.NozzleType = this.tabNozzle.SelectedIndex;
			this.Layway = 1;
			LaySideAirTerminalLineForm laySideAirTerminalLineForm = new LaySideAirTerminalLineForm(this.userSetting);
			if (laySideAirTerminalLineForm.ShowDialog() == DialogResult.OK)
			{
				this.laySideParam = laySideAirTerminalLineForm.layParameter;
			}
			this.GetLayNozzleData();
		}

		private void GetLayNozzleData()
		{
			if (this.tabNozzle.SelectedIndex == 0)
			{
				if (this.dgvGlobe.SelectedRows.Count < 1)
				{
					YJKMessageBox.Show("请先选择喷口的型号数据再进行布置");
					return;
				}
				this.GlobeNozzleData = new GlobeNozzle();
				this.GlobeNozzleData = (this.dgvGlobe.SelectedRows[0].Cells[0].Value as GlobeNozzle);
			}
			else
			{
				if (this.dgvCy.SelectedRows.Count < 1)
				{
					YJKMessageBox.Show("请先选择喷口的型号数据再进行布置");
					return;
				}
				this.CylindricalNozzleData = new CylindricalNozzle();
				this.CylindricalNozzleData = (this.dgvCy.SelectedRows[0].Cells[0].Value as CylindricalNozzle);
			}
			this.WriteFormData();
			base.DialogResult = DialogResult.OK;
		}

		private void btnCancle_Click(object sender, EventArgs e)
		{
			base.DialogResult = DialogResult.Cancel;
		}

		private GlobeFormData gfd = new GlobeFormData();

		private CylindricalFormData cfd = new CylindricalFormData();

		private NozzleSqlData nsd;

		private readonly bool _isFirstInit;

		public LaySideParameter laySideParam;

		private HVACUserSetting userSetting = new HVACUserSetting();

		private string gcol = "0";

		private string grow = "0";

		private string cycol = "0";

		private string cyrow = "0";

		private string tabindex = "0";
	}
}
